import java.util.*;

public class MergeSortedLists {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int[] a = new int[4];
        int[] b = new int[5];



        System.out.println("请输入La的值：");
        int p = 0;
        while (scanner.hasNextInt()) {
            a[p] = scanner.nextInt();
            p++;
            if (p >= a.length) {
                break;
            }
        }
        System.out.println("请输入Lb的值：");
        p = 0;
        while (scanner.hasNextInt()) {
            a[p] = scanner.nextInt();
            p++;
            if (p >= a.length) {
                break;
            }
        }
        for (int x : a) {
            System.out.print(x + " ");
        }
        System.out.println();
        for (int x : b) {
            System.out.print(x + " ");
        }



        union(a, b);
    }

    public static void union(int[] p, int[] q) {
        HashSet<Integer> hashSet = new HashSet<>();
        for (int i = 0; i < p.length; i++) {
            hashSet.add(p[i]);
        }
        for (int i = 0; i < q.length; i++) {
            hashSet.add(q[i]);
        }
        System.out.println(hashSet);
    }
}

